package com.zzyk.main.service;

import com.zzyk.main.model.pojo.AlarmInfo;
import com.zzyk.main.model.pojo.AlarmMsgLog;
import com.zzyk.main.model.pojo.CommonCount;
import com.zzyk.main.model.vo.AlarmInfoToMonth;
import com.zzyk.main.model.vo.Message;

import java.util.List;
import java.util.Map;

public interface AlarmInfoService {


    int deleteByPrimaryKey(Integer id);

    int insert(AlarmInfo record);

    int insertSelective(AlarmInfo record);

    AlarmInfo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(AlarmInfo record);

    int updateByPrimaryKey(AlarmInfo record);

    /**
     * 多条件查询
     *
     * @param eId
     * @param dId
     * @param beginTime
     * @param endTime
     * @param status
     * @param areas
     * @param pageIndex
     * @param pageSize
     * @param deviceList
     * @return
     */
    Message selectAlarmByParams(Long eId, Long dId, String beginTime, String endTime, Long status, String[] areas, Integer pageIndex, Integer pageSize, Integer[] deviceList);

    /**
     * 统计各个报警级别的数量
     *
     * @param enterprise
     * @param areas
     * @param eId
     * @param dId
     * @param beginTime
     * @param endTime
     * @param status
     * @param deviceList
     * @return
     */
    List<CommonCount> findCountAlarm(Long enterprise, String[] areas, Long eId, Long dId, String beginTime, String endTime, Long status, Integer[] deviceList);

    /**
     * 多条件查询报警推送日志
     *
     * @param eId
     * @param beginTime
     * @param endTime
     * @param status
     * @param areas
     * @param type
     * @return
     */
    List<AlarmMsgLog> selectAlarmMsgLog(Long eId, String beginTime, String endTime, String status, String[] areas, Integer type);

    /**
     * 多条件查询 前十条
     *
     * @param eId
     * @param dId
     * @param beginTime
     * @param endTime
     * @param status
     * @return
     */
    List<AlarmInfo> selectAlarmByParamsTop10(Long eId, Long dId, String beginTime, String endTime, Long status);



    /**
     * 获取本月每天报警数据统计
     *
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<AlarmInfoToMonth> selectToMonthAlarmData(Integer enterprise, Integer[] deviceList);

    /**
     * 统计传入时间的今天和昨天每个小时的报警数量
     *
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<Integer, Integer>> findCountAlarmsByHour(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 查询某一天的各个告警状态的数量
     *
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> countToDayAlarmNumber(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 根据设备内容查询某个企业下某天告警数量根据报警内容分组
     *
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> findAlarmNumberGroupByContent(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 根据设备类型分组查询各个设备类型的报价数量
     *
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> selectAlarmDeviceType(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 根据时间范围和企业ID统计每天的告警数量
     *
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> selectAlarmStatistics(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 获取告警处理信息
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> selectAlarmHandlingInformation( String dateStr,  Integer enterprise, Integer[] deviceList);

    /**
     * 告警原因分布
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> selectAlarmCauseDistribution(String dateStr, Integer enterprise, Integer[] deviceList);

    /**
     * 历史试图 告警设备类型
     * @param dateStr
     * @param enterprise
     * @param deviceList
     * @return
     */
    List<Map<String, Integer>> selectHistoryAlarmDeviceType(String dateStr, Integer enterprise, Integer[] deviceList);

    Message selectRecentAlertNotification(Integer type, Integer enterprise, Integer pageIndex, Integer pageSize, Integer methodType);

    List<AlarmInfo> getAlarmCountBy(String dateStr, Integer enterprise, Integer[] deviceList);

    List<AlarmInfo> getCountHistoryAlarmDeviceType(String dateStr, Integer enterprise, Integer[] deviceList);

    List<AlarmInfo> apiSelectAlarmByParams(Long eId, Long dId, String beginTime, String endTime, Long status, String[] areas, Integer[] deviceList);
}
